<template>
	<div>
		<ul>
			<li v-for="m in messageList" :key="m.id">
				<!-- 给路由组件传递query参数(原始的麻烦写法) -->
				<!-- <router-link :to="`/home/message/detail?id=${m.id}&title=${m.title}&content=${m.content}`">{{m.title}}</router-link> -->

				<!-- 给路由组件传递query参数(对象写法) -->
				<router-link 
					:to="{
						name:'xiangqing',
						query:{
							id:m.id,
							title:m.title,
							content:m.content,
						}
						//query:{...m}
					}"
				>
					{{m.title}}
				</router-link>
			</li>
		</ul>
		<hr/>
		<router-view></router-view>
	</div>
</template>

<script>
	export default {
		name:'Message',
		data(){
			return {
				messageList:[
					{id:'001',title:'消息1',content:'你好，中国'},
					{id:'002',title:'消息2',content:'你好，北京'},
					{id:'003',title:'消息3',content:'你好，尚硅谷'}
				]
			}
		}
	}
</script>
